package listening;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * ServletContext生死监听
 *
 * 作用:可以在这个监听器春发一些tomcat启动时就要完成的代码
 *
 * Created by kevin on 2020/4/8.
 */
@WebListener
public class AListener implements ServletContextListener{
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("我来了");
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("我走了");
    }
}
